package com.anlu.base.async.config;

import lombok.Data;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @author anlu
 * @Date
 * @desc
 */
@Data
@Component
@ConfigurationProperties(prefix = "anlu.async")
@ConditionalOnProperty(value = "anlu.async.enable",havingValue = "true")
public class AsyncProperties {

    private Integer corePoolSize = 8;
    private Integer maxPoolSize = 200;

    private Integer queueCapacity = 20;
    private Integer keepAliveSeconds = 60;

    private String threadNamePrefix = "taskExecutor-";

    public Integer getCorePoolSize() {
        return corePoolSize;
    }

    public Integer getMaxPoolSize() {
        return maxPoolSize;
    }

    public Integer getQueueCapacity() {
        return queueCapacity;
    }

    public Integer getKeepAliveSeconds() {
        return keepAliveSeconds;
    }

    public String getThreadNamePrefix() {
        return threadNamePrefix;
    }
}
